﻿@model IEnumerable<QuestionsAnswers.UI.Models.Answer>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Add Answer", "Create",new {id = @ViewBag.Question.QuestionId})
</p>
<p>
@ViewBag.Question.Text
</p>
<table>
    <tr>
        <th>
            Text
        </th>
        <th>
            User
        </th>
        
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Text)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.User.UserName)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.AnswerId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.AnswerId })
        </td>
    </tr>
}

</table>
